// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import IOT_API from '@admin/views/System/IOT/IOTList/store/API_DETAIL'

// ============================== 导出异步调用 ============================== //

export default {
  // —————————————————————————————— 单项 —————————————————————————————— //

  async remoteOne({ state: { one }, rootState: { API } }) {
    // 查询关联的设备和资产 ID 名称
    const TIP = API.transTip(`查询${CORE.MAP.ALARM}的关联${CORE.MAP.ASSET}`)
    const { assetId, assetName } = await IOT_API.getOne({ id: one.deviceId }, TIP).catch(() => ({}))
    return { ...one, assetId, assetName }
  },
}
